<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        ul {
            list-style-type: none;
        }
    </style>
</head>

<body>
    <ul>
        <li score="80">数学</li>
        <li score="70">语文</li>
        <li score="40">英语</li>
    </ul>
    <script>
    var liObjets  = document.getElementsByTagName("li");
     for (const liObjet of liObjets) {
          liObjet.onclick = function (){
              alert(this.getAttribute("score"));
          }
     }
    </script>
</body>

</html>